package com.topnav.mc.admin.entity.wrapper;

import com.topnav.mc.admin.entity.param.DeviceParam;
import com.topnav.mc.admin.entity.param.FenceParam;
import com.topnav.mc.base.mc.McWrapper;

/**
 * @Author: kenny
 * @Date: 2023/11/13 10:31
 */
public class FenceWrapper extends McWrapper<FenceParam> {
    public FenceWrapper(FenceParam entity) {
        super(entity);
        if (this.permissionGrade != null ){
            if (this.permissionGrade.getPermissionLevel() == 1){
                this.eq("f.org_id",this.permissionGrade.getUserId());
            }else if (this.permissionGrade.getPermissionLevel() == 2){
                this.eq("f.org_id",this.permissionGrade.getOrgId());
            }else if (this.permissionGrade.getPermissionLevel() == 3 || this.permissionGrade.getPermissionLevel() == 4){
                this.likeRight("f.path",this.permissionGrade.getOrgPath());
            }
        }
        if (entity != null){
            if (entity.getId()!=null){this.eq("f.id",entity.getId());}
            if (entity.getOrgId()!=null){this.eq("f.org_id",entity.getOrgId());}
        }
    }
}
